package com.example.qdindex.controller;

import com.example.qdindex.biz.GouWuCheBiz;
import org.example.bean.KeHuInfo;
import org.example.bean.TushuInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

@RestController
@RequestMapping("/GWC")
public class GouWuCheController {
    @Autowired
    private GouWuCheBiz gwcb;
    @RequestMapping(value = "/findGWCB",produces = {"application/json;charset=utf-8"})
    public List<TushuInfo> findGWCByKeHuId(HttpSession session) {
        KeHuInfo kehu = (KeHuInfo) session.getAttribute("KEHU_DENGLU");
        return gwcb.findGWCByKeHuId(kehu.getKehuid());
    }

    @RequestMapping("/updateShuliang")
    public void updateGWCShuliang(int shuliang, int tuShuId) {
        gwcb.updateGWCShuliang(shuliang,tuShuId);
    }
}
